package com.demo3;

import java.util.Scanner;

/**
 * 正方形
 * @author J.L.Zhou
 *	jlzhou.top 版权所有
 */
public class Square extends Rectangle {


	public Square(){
		super("正方形");
	}
	


	@Override
	public void inputBaseInfo(Scanner sc) {
		System.out.println("输入"+getName()+"的边长: ");
		float width = sc.nextFloat();
		super.setWidth(width);
		super.setHeight(width);
	}


	@Override
	public String getBaseInfo() {
		return String.format("边长：%.2f",getWidth());
	}



	
	public static void main(String[] args) {
		Square rectangle = new Square();
		rectangle.input(new Scanner(System.in));
		rectangle.show();
	}

}
